package com.epoint.mobileoa.personalized.epointcompany.ui.gzrz.task;

import java.util.List;
import java.util.Map;

import android.os.Message;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.db.DBHelp;
import com.epoint.mobileoa.personalized.epointcompany.model.GongzuomingxiModel;
import com.epoint.mobileoa.tools.WebServiceUtilDAL;

/**
 * @author liyc
 * @time 2012-9-5 下午5:08:43
 * @annotation 
 */
public class RZCheckClickTask extends Task {

	/**
	 * @param con
	 * @param param
	 */
	public RZCheckClickTask(SuperView con, Map<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		List<GongzuomingxiModel> list = (List<GongzuomingxiModel>) getParam().get("list");
		for(GongzuomingxiModel gm:list)
		{
			String DetailRowGuid = gm.Rowguid;
			String CheckWorkSJ = gm.CheckWorkSJ;
			String url = getCon().getString(R.string.epointcompany_rizhi_url);
			String namespace = getCon().getString(R.string.epointcompany_rizhi_namespace);
			String method = "RZCheckSaveSingleDetail";
			WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
					method, namespace);
			
			webservice.addProperty("DetailRowGuid", DetailRowGuid);
			webservice.addProperty("CheckWorkSJ", CheckWorkSJ);
			webservice.start();
		}
		String RZRowGuid = getParam().get("RZRowGuid").toString();
		String CheckedUserGuid = getParam().get("CheckedUserGuid").toString();
		String RZDate = getParam().get("RZDate").toString();
		String PSContent = getParam().get("PSContent").toString();
		String CurrentUserName = getFP().getDisplayname();
		String CurrentUserGuid = getFP().getUserguid();
		String CurrentOuGuid = DBHelp.getUserOuguid(getCon(), CurrentUserGuid);
		String url = getCon().getString(R.string.epointcompany_rizhi_url);
		String namespace = getCon().getString(R.string.epointcompany_rizhi_namespace);
		String method = "RZCheckClick";
		WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
				method, namespace);
		webservice.addProperty("RZRowGuid", RZRowGuid);
		webservice.addProperty("CheckedUserGuid", CheckedUserGuid);
		webservice.addProperty("RZDate", RZDate);
		webservice.addProperty("PSContent", PSContent);
		webservice.addProperty("CurrentUserName", CurrentUserName);
		webservice.addProperty("CurrentUserGuid", CurrentUserGuid);
		webservice.addProperty("CurrentOuGuid", CurrentOuGuid);
		String bs = webservice.start();
		setMessageToRefreshUI(mess, getCon(), bs);
	}

}
